package com.aube.control;

import android.content.Context;
import android.view.ViewGroup;

import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.aube.control.player.MultiVideoBalanceAdapter;
import com.aube.model.TimeLineData;
import com.aube.model.TimeLineModel;
import com.aube.model.TimeLinePiece;
import com.aube.model.VideoItem;
import com.aube.model.VrDataModel;
import com.aube.model.VrItem;
import com.aube.multiscreen.CameraCardView;
import com.aube.multiscreen.IEnterAndExitListener;
import com.aube.multiscreen.IVideoStateListener;
import com.aube.multiscreen.MultiCameraTransitionHelper;
import com.aube.multiscreen.MultiCameraView;
import com.google.gson.Gson;
import com.huyn.baseframework.dynamicload.video.AbstractController;
import com.huyn.baseframework.model.ChannelDetail;
import com.huyn.baseframework.net.BFJSONRequest;
import com.huyn.baseframework.net.HttpRequestLoader;
import com.huyn.baseframework.net.OpenApi;
import com.huyn.baseframework.statistics.AubeStatisticEvents;
import com.huyn.baseframework.statistics.AubeStatisticTool;
import com.huyn.baseframework.statistics.EventValuePair;
import com.huyn.baseframework.utils.StringUtils;
import com.huyn.baseframework.utils.UmengUtils;
import com.huyn.baseframework.utils.Utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * 多镜头控制逻辑
 * Created by huyaonan on 16/3/23.
 */
public class MultiScreenController extends AbstractController<TimeLinePiece> {

    private CameraCardView mMainScreen;
    private MultiCameraTransitionHelper helper;

    private TimeLineData mVideoData;

    private List<VrItem> mVrDataTemp;
    private List<VrItem> mVrData;
    private VrItem mCurrentVrItem;
    private AtomicBoolean mCardAnimExecuted = new AtomicBoolean(false);
    private AtomicBoolean mCanManageVideos = new AtomicBoolean(false);

    private static final int PRELOAD_DELTA = 20;

    private AtomicBoolean mIsPlaying = new AtomicBoolean(true);
    private long mCurrentSecond = 0;

    private MultiVideoBalanceAdapter mVideoBalanceAdapter;

    public MultiScreenController(final Context context, ViewGroup mRoot, final ChannelDetail mChannel, final IControllerCallback callback) {
        super(context, mRoot, mChannel, callback);

//        mMainScreen = (CameraCardView) mRoot.findViewById(R.id.main_screen);
        mMainScreen = (CameraCardView) mRoot.getChildAt(0);

        helper = new MultiCameraTransitionHelper();
        helper.setIVideoStateListener(new IVideoStateListener() {
            @Override
            public void changeState(boolean visible) {
            }

            @Override
            public void toFullScreen(String title, boolean isVr) {
                if(callback != null)
                    callback.toFullScreen(title, isVr);
            }

            @Override
            public void reserveFullScreen(boolean exitMultiVideo) {
                if(callback != null)
                    callback.reserveFullScreen(exitMultiVideo);
            }

            @Override
            public void manageTools() {
                if (iControllerCallback != null)
                    iControllerCallback.managerTools();
            }

            @Override
            public void switchGoodsHotpotSize(boolean fullScreen) {
                if(callback != null)
                    callback.switchGoodsHotpotSize(fullScreen);
            }

            @Override
            public void updateTitle(String title) {
                Utils.Log(TAG, "updateTitle : " + title);
                if(callback != null)
                    callback.updateTitle(title);
            }

            @Override
            public void manageProgress(boolean speedUp, float ratio, boolean doSeek) {
                if(callback != null)
                    callback.manageProgress(speedUp, ratio, doSeek);
            }

            @Override
            public long getCurrentProgress() {
                if(callback != null)
                    return callback.getCurrentProgress();
                return 0;
            }

            @Override
            public long getDuration() {
                if(callback != null)
                    return callback.getDuration();
                return 0;
            }

            @Override
            public void showTools(int time) {
                if(callback != null)
                    callback.showTools(time);
            }

            @Override
            public void cancelSeek() {
                if(callback != null)
                    callback.cancelSeek();
            }

            @Override
            public ChannelDetail getChannelDetail() {
                return mChannel;
            }

            @Override
            public void mainVideoChanged(int current) {
                if(callback != null)
                    callback.mainVideoChanged(current);
            }

            @Override
            public void initToolBar(boolean onMajorVideo) {
                if(callback != null)
                    callback.initToolBar(onMajorVideo);
            }

            @Override
            public void endUpdateProgress() {
                if(callback != null)
                    callback.endUpdateProgress();
            }

            @Override
            public void onStartTrackingTouch() {
                if(callback != null)
                    callback.onStartTrackingTouch();
            }

            @Override
            public boolean isPlaying() {
                if(callback != null)
                    return callback.isPlaying();
                return false;
            }

            @Override
            public void updateProgressBySubVideo(long current) {
                if(callback != null)
                    callback.updateProgressBySubVideo(current);
            }

            @Override
            public boolean isInMultiVideoMode() {
                if(mCurrentData != null && mCurrentSecond >= 0) {
                    if(mCurrentData.startSeconds <= mCurrentSecond)
                        return true;
                }
                return false;
            }
        });
        helper.bindView((MultiCameraView) mRoot);

        mMainScreen.initContent(new VideoItem("主视角"), 0, helper);

        ((MultiCameraView) mRoot).addToChildrenGroup(0+"", mMainScreen);
        ((MultiCameraView) mRoot).setVideoHelper(helper);

        mVideoBalanceAdapter = MultiVideoBalanceAdapter.getInstance();
        mVideoBalanceAdapter.reset();
        mVideoBalanceAdapter.registBalanceCallBack(new MultiVideoBalanceAdapter.OnVideoBalanceCallBack() {
            @Override
            public void pauseAndWarn() {
                //pause all videos and show a warning tip
                if(callback != null)
                    callback.pauseAllPlayers();

                UmengUtils.reportUmengEvent(context, UmengUtils.MULTIVIDEO_FREEZE, mChannel.videoid);
            }
        });
    }

    public void reverseFromFullScreen() {
        if(helper != null)
            helper.reverseFromFullScreen(false);
    }

    @Override
    public boolean setupCards(long selectedIndex, boolean freshData, boolean autoBegin) {
        //不重置当前数据,以免每次都要重新加载
//        mCurrentData = null;

        if(setupCards(selectedIndex, autoBegin))
            return true;

        if(freshData) {
            loadMultiScreenTimeline(selectedIndex);
            loadVrTimeline(selectedIndex);
            return true;
        }

        return false;
    }

    /**
     * 加入预加载时间节点
     * @param selectedIndex
     * @return
     */
    public boolean setupCards(long selectedIndex, boolean autoBegin) {
        clearCardsList();
        if(mVideoData == null || mVideoData.timeline == null)
            return false;
        synchronized (mCardsList) {
            mCardsList.clear();
            long currentSecond = selectedIndex / 1000;
            int lastEndSeconds = 0;
            for(TimeLinePiece item : mVideoData.timeline) {
                Utils.Log(TAG, "start:" + item.startSeconds + "---" + "end:" + item.endSeconds + "---" + currentSecond + "--" + selectedIndex);
                if(item.endSeconds <= currentSecond)
                    continue;

                item.initVideoIndex();

                int preLoadSeconds = item.startSeconds - PRELOAD_DELTA;
                if(preLoadSeconds < 0)
                    item.preloadSeconds = 0;
                else {
                    if(preLoadSeconds < lastEndSeconds)
                        item.preloadSeconds = lastEndSeconds;
                    else
                        item.preloadSeconds = preLoadSeconds;
                }

                //如果当前时间超过预载时间,放弃预载
                Utils.Log(TAG, "card preload seconds:" + item.preloadSeconds + "__" + currentSecond);
                if(item.preloadSeconds <= currentSecond) {
                    if(currentSecond >= item.startSeconds-5)
                        item.preloadSeconds = item.startSeconds;
                    else
                        item.preloadSeconds = (int) (currentSecond + 2);
                }

                Utils.Log(TAG, "start at:" + currentSecond + "___" + item.type + "___" + item.startSeconds + "___" + item.preloadSeconds + "/" + item.endSeconds);

                lastEndSeconds = item.endSeconds;
                mCardsList.add(item);
            }

            setupVrCards(selectedIndex);

            if(!autoBegin) {
                locateCardByTime(selectedIndex, true);
//                if(mCardsList.size() > 0 && mCurrentData != null) {
//                    TimeLinePiece firstItem = mCardsList.get(0);
//                    if(mCurrentData.rid.equalsIgnoreCase(firstItem.rid)) {
//                        locateCardByTime(selectedIndex, true);
//                        return true;
//                    }
//                }
//                manageCard(null);
            }
        }
        return true;
    }

    private void setupVrCards(long selectedIndex) {
        //vr预加载处理
        if(mVrDataTemp == null)
            return;
        if(mVrData == null)
            mVrData = new ArrayList<>();
        else
            mVrData.clear();
        long currentSecond = selectedIndex / 1000;
        int lastEndSeconds = 0;
        for(VrItem item : mVrDataTemp) {
            Utils.Log(TAG, "start:" + item.startSeconds + "---" + "end:" + item.endSeconds + "---" + currentSecond + "--" + selectedIndex);
            if(item.endSeconds <= currentSecond)
                continue;

            int preLoadSeconds = item.startSeconds - PRELOAD_DELTA;
            if(preLoadSeconds < 0)
                item.preloadSeconds = 0;
            else {
                if(preLoadSeconds < lastEndSeconds)
                    item.preloadSeconds = lastEndSeconds;
                else
                    item.preloadSeconds = preLoadSeconds;
            }

            //如果当前时间超过预载时间,放弃预载
            Utils.Log(TAG, "card preload seconds:" + item.preloadSeconds + "__" + currentSecond);
            if(item.preloadSeconds <= currentSecond) {
                if(currentSecond >= item.startSeconds-5)
                    item.preloadSeconds = item.startSeconds;
                else
                    item.preloadSeconds = (int) (currentSecond + 2);
            }

            Utils.Log(TAG, "start at:" + currentSecond + "___" + item.type + "___" + item.startSeconds + "___" + item.preloadSeconds + "/" + item.endSeconds);

            lastEndSeconds = item.endSeconds;
            mVrData.add(item);
        }
    }

    @Override
    public boolean locateCardByTime(long current) {
        return locateCardByTime(current, false);
    }

    public boolean locateCardByTime(long current, boolean dragMode) {
        if(current < 0)
            return manageCard(null);

        if(helper != null)
            helper.updateProgress(current);

        synchronized (mCardsList) {
            mCurrentSecond = current / 1000;

            manageVrVideo(mCurrentSecond, dragMode);

            if(mCurrentData != null) {
//                Utils.Log(TAG, "mCurrentData card time:" + mCurrentData.preloadSeconds + "/" + mCurrentData.startSeconds + "/" + mCurrentData.endSeconds + "/" + mCurrentSecond);
                //当seek的时候,播放起点并不是准确时间点,而是会往前走个1s左右,这里定了个3s的误差,此时超出了当前镜头的播放时间,会被抛弃
                if(mCurrentData.endSeconds <= mCurrentSecond || mCurrentData.preloadSeconds > mCurrentSecond + 3) {
//                    mCurrentData = null;
//                    Utils.Log(TAG, "do nothing...");
                } else if(mCurrentSecond < mCurrentData.startSeconds && dragMode) {
                    //当拖动的目标位置正好处在预载时间和正式播放时间之间,应该是消失状态,应该重置当前卡片
//                    Utils.Log(TAG, "clear card...");
                    mCurrentData = null;
                    return manageCard(null);
                } else {
//                    Utils.Log(TAG, "continue current card...");
                    return manageCard(mCurrentData, mCurrentSecond);
                }
            }

            if(mCardsList.size() == 0)
                return manageCard(null);

            TimeLinePiece firstItem = mCardsList.get(0);
            int startSeconds = firstItem.preloadSeconds;
            if(dragMode)
                startSeconds = firstItem.startSeconds;
//            Utils.Log(TAG, "load card time:" + firstItem.startSeconds + "/" + firstItem.endSeconds + "/" + mCurrentSecond);
            if(startSeconds <= mCurrentSecond && firstItem.endSeconds > mCurrentSecond) {
                Utils.Log(TAG, "CAMERA____load card:" + firstItem.title + "_type:" + firstItem.type + " at time:" + mCurrentSecond);
                mCardsList.remove(0);
                return manageCard(firstItem, mCurrentSecond);
            } else if(firstItem.endSeconds <= mCurrentSecond) {
                Utils.Log(TAG, "clear data at top");
                mCardsList.remove(0);
            } else {
//                Utils.Log(TAG, "no data");
            }

            return manageCard(null);
        }
    }

    private boolean manageVrVideo(long currentSecond, boolean dragMode) {
        if(mVrData == null)
            return manageVrVideo(null);

//        if(mCurrentVrItem != null) {
//            if(mCurrentVrItem.endSeconds <= currentSecond || mCurrentVrItem.startSeconds > currentSecond) {
//            } else
//                return manageVrVideo(mCurrentVrItem);
//        }
//
//        if(mVrData.size() == 0)
//            return manageVrVideo(null);
//
//        VrItem firstItem = mVrData.get(0);
//        int startSeconds = firstItem.startSeconds;
//        if(startSeconds <= currentSecond && firstItem.endSeconds > currentSecond) {

        if(mCurrentVrItem != null) {
            if(mCurrentVrItem.endSeconds <= currentSecond || mCurrentVrItem.preloadSeconds > currentSecond) {
//                mCurrentData = null;
            } else
                return manageVrVideo(mCurrentVrItem, currentSecond);
        }

        if(mVrData.size() == 0)
            return manageVrVideo(null);

        VrItem firstItem = mVrData.get(0);
        int startSeconds = firstItem.preloadSeconds;
        if(dragMode)
            startSeconds = firstItem.startSeconds;
        if(startSeconds <= currentSecond && firstItem.endSeconds > currentSecond) {
            Utils.Log(TAG, "CAMERA____load vr" + " at time:" + currentSecond);
            mVrData.remove(0);
            return manageVrVideo(firstItem, currentSecond);
        } else if(firstItem.endSeconds <= currentSecond) {
            Utils.Log(TAG, "clear data at top");
            mVrData.remove(0);
        } else {
//                Utils.Log(TAG, "no data");
        }

        return manageVrVideo(null);
    }

    private boolean manageVrVideo(VrItem data) {
        return manageVrVideo(data, 0);
    }

    private boolean manageVrVideo(VrItem data, long current) {
        try {
            if (data != null) {
                if(!data.isLegal())
                    return true;
                if (mCurrentVrItem != null) {
                    if (mCurrentVrItem.rid.equalsIgnoreCase(data.rid)) {
//                        Utils.Log(TAG, "VR____load vr");
                        mMainScreen.attachVrVideo(data, current);
                        return true;
                    } else {
                        mCurrentVrItem = data;
                        mMainScreen.replaceVrVideo(data, current);
//                        Utils.Log(TAG, "VR____replace vr");
                    }
                } else {
                    mCurrentVrItem = data;
                    mMainScreen.attachVrVideo(data, current);
//                    Utils.Log(TAG, "VR____load vr");
                }
            } else {
                mCurrentVrItem = null;
                mMainScreen.detachVrVideo();
//                Utils.Log(TAG, "VR____remove vr");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public boolean manageCard(TimeLinePiece data) {
        return manageCard(data, 0);
    }

    public boolean manageCard(final TimeLinePiece data, final long current) {
        try {
            if (data != null) {
                if (mCurrentData != null) {
                    if (mCurrentData.rid.equalsIgnoreCase(data.rid)) {
//                        Utils.Log(TAG, "========updata card");
                        animIn(data, current);
                        return true;
                    } else {
//                        Utils.Log(TAG, "========replace card");
                        mCurrentData = data;
                        removeFromScreen(new IEnterAndExitListener() {
                            @Override
                            public void onExit() {
                                mCardAnimExecuted.set(false);
                                mCanManageVideos.set(false);
                                appendToScreen(data);
                                animIn(data, current);
                            }

                            @Override
                            public void onEnter() {

                            }
                        });
                    }
                } else {
                    mCardAnimExecuted.set(false);
                    mCanManageVideos.set(false);
                    appendToScreen(data);
                    mCurrentData = data;
                    animIn(data, current);
                }
            } else {
//                Utils.Log(TAG, "=================clear card");
                mCardAnimExecuted.set(false);
                mCanManageVideos.set(false);
                mCurrentData = null;
                if (mCardRoot.getChildCount() > 1) {
                    removeFromScreen();
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    /**
     * 多镜头入场逻辑
     * @param data
     * @param current
     */
    private synchronized void animIn(TimeLinePiece data, long current) {
        if(data.startSeconds <= current) {
            if (!mCardAnimExecuted.get()) {
                Utils.Log(TAG, "CAMERA____card show");
                mCardAnimExecuted.set(true);
                mMainScreen.updateTitle(data.title);
                //卡片出现的时候,才开始监听
                mVideoBalanceAdapter.recount();

                //统计多镜头出现事件
                AubeStatisticTool.getInstance(context).report(AubeStatisticEvents.MULTIVIDEO_DISPLAY,
                        AubeStatisticEvents.formatValues(new EventValuePair("vid", mChannel.videoid), new EventValuePair("time", current+"")));

                //统计多镜头播放次数
                DataManager.getInstance(context).updateVideoPlayCount(mChannel.videoid, false);
                AubeStatisticTool.getInstance(context).report(AubeStatisticEvents.VIDEO_PLAY_COUNTT,
                        AubeStatisticEvents.formatValues(new EventValuePair("vid", mChannel.videoid),
                                                         new EventValuePair("playcount", String.valueOf(DataManager.getInstance(context).getVideoPlayCount(mChannel.videoid)))));

                helper.cardIn(data, current, new IEnterAndExitListener() {

                    @Override
                    public void onExit() {

                    }

                    @Override
                    public void onEnter() {
                        mCanManageVideos.set(true);
                    }
                });

                if (iControllerCallback != null) {
                    iControllerCallback.reserveFullScreen(false);

                    if(StringUtils.isNotBlank(data.tlDesc))
                        iControllerCallback.videoTipsIn(data.tlDesc);
                }
            } else {
                if(mCanManageVideos.get())
                    helper.manageVideos(data, current);
            }
        }
    }

    public void loadMultiScreenTimeline(final long selectedIndex) {
        if(mChannel == null) {
            Utils.showToast(context, "没有节目");
            return;
        }
        HashMap<String, String> parameterMap = new HashMap<String, String>();
        parameterMap.put(OpenApi.API_METHOD, OpenApi.MULTI_SCREEN_TIMELINE);
        parameterMap.put("showid", mChannel.showid);
        parameterMap.put("videoid", mChannel.videoid);
        BFJSONRequest request = new BFJSONRequest(TimeLineModel.class, parameterMap, new Response.Listener<TimeLineModel>() {

            @Override
            public void onResponse(TimeLineModel response) {
                TimeLineData mData = response.data;

                if(response.success()) {
                    if(mData == null)
                        return;

                    mVideoData = mData.init();
                    setupCards(selectedIndex, true);

                    if(iControllerCallback != null)
                        iControllerCallback.updateBg(mVideoData.getBgUrl());
                } else {
//                    Utils.showToast(context, response.errormsg);
                }
            }

            @Override
            public void onErrorResponse(VolleyError error) {
            }

            @Override
            public void onStart() {
            }
        });
        request.setTag(TAG);
        HttpRequestLoader.getInstance(context).startCacheLoader("", request, true);
    }

    public void loadVrTimeline(final long selectedIndex) {
        if(mChannel == null) {
            Utils.showToast(context, "没有节目");
            return;
        }
        HashMap<String, String> parameterMap = new HashMap<String, String>();
        parameterMap.put(OpenApi.API_METHOD, OpenApi.VR_TIMELINE);
        parameterMap.put("showid", mChannel.showid);
        parameterMap.put("videoid", mChannel.videoid);
        BFJSONRequest request = new BFJSONRequest(VrDataModel.class, parameterMap, new Response.Listener<VrDataModel>() {

            @Override
            public void onResponse(VrDataModel response) {
                //response = parseVrData();//for test
                if(response.success()) {
                    if(response.notNull()) {
                        mVrDataTemp = response.data.timeline;

                        setupVrCards(selectedIndex);
                    }
                } else {
//                    Utils.showToast(context, response.errormsg);
                }
            }

            @Override
            public void onErrorResponse(VolleyError error) {
            }

            @Override
            public void onStart() {
            }
        });
        request.setTag(TAG);
        HttpRequestLoader.getInstance(context).startCacheLoader("", request, true);
    }

    @Override
    public void appendToScreen(TimeLinePiece data) {
//        removeFromScreen();

        prepareVideoHeler(data);
    }

    private void prepareVideoHeler(final TimeLinePiece data) {
        helper.addViews(data, mIsPlaying.get());

        UmengUtils.reportUmengEvent(context, UmengUtils.SHOW_MULTIVIDEO, UmengUtils.appendLabels(data.title, mChannel.videoid, mChannel.videoTitle));
    }

    public void start() {
        mIsPlaying.set(true);
        if(helper != null)
            helper.start();
    }

    public void pause() {
        mIsPlaying.set(false);
        if(helper != null)
            helper.pause();
    }

    public void pauseWhenFreeze() {
        if(helper != null)
            helper.pauseWhenFreeze();
    }

    public void seek(long target) {
        if(helper != null && mCardAnimExecuted.get()) {
            helper.doSeek(target);
        }
    }

    @Override
    public void removeFromScreen() {
        if(helper != null)
            helper.exit(null);

        mVideoBalanceAdapter.recount();

        Utils.Log(TAG, "exit multicamera");

        //重置顶部工具栏
        if(iControllerCallback != null)
            iControllerCallback.reserveFullScreen(true);
    }

    protected void removeFromScreen(IEnterAndExitListener listener) {
        if(iControllerCallback != null)
            iControllerCallback.videoTipsOut();
        if(helper != null)
            helper.exit(listener);

        Utils.Log(TAG, "replace multicamera");

        //重置顶部工具栏
        if(iControllerCallback != null)
            iControllerCallback.reserveFullScreen(true);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if(helper != null) {
            helper.onDestroy();
            helper = null;
        }
    }

    @Override
    public boolean onBack() {
        if(helper != null)
            return helper.onBack();
        return super.onBack();
    }

    @Override
    public void end() {
        Utils.Log(TAG, "end play");
        super.end();
        mIsPlaying.set(false);
    }

    private VrDataModel parseVrData() {
        Gson gson = new Gson();
        VrDataModel feed = gson.fromJson(TEST_JSON, VrDataModel.class);
        return feed;
    }

    /**
     * vrtimeline的数据结构
     */
    private static final String TEST_JSON = "{\"code\": \"0000\",\"errormsg\": \"OK\",\"data\":{\"timeline\":[{" +
                                                                "\"type\": \"MULTICAMERA\"," +
                                                                "\"rid\": \"15530\"," +
                                                                "\"startSeconds\": 10," +
                                                                "\"endSeconds\": 30," +
                                                                "\"title\": \"10s开始\"," +
                                                                "\"tlDesc\": \"啊啊啊\"," +
                                                                "\"config\": { }," +
                                                                "\"detail\": {" +
                                                                    "\"videoid\": \"15531\"," +
                                                                    "\"videono\": \"E70BA93DC9A3ED9C9C33DC5901307461\"," +
                                                                    "\"videoTitle\": \"的\"," +
                                                                    "\"duration\": 42," +
                                                                    "\"cameraType\": \"NORMAL\"," +
                                                                    "\"soundSwitch\": \"N\"," +
                                                                    "\"delayTime\": 3," +
                                                                    "\"aubeVideoid\": \"15004\"," +
                                                                    "\"updownAngle\": \"0\"," +
                                                                    "\"leftRightAngle\": \"0\"," +
                                                                    "\"videoPlay\": {" +
                                                                        "\"defaultdefinition\": 10," +
                                                                        "\"definitionDescription\": [" +
                                                                            "\"流畅360P\"," +
                                                                            "\"标清480P\"," +
                                                                            "\"高清720P\"" +
                                                                        "]," +
                                                                        "\"definitions\": [" +
                                                                            "{" +
                                                                                "\"definition\": 10," +
                                                                                "\"desp\": \"流畅360P\"," +
                                                                                "\"playurl\": \"http://upyun.aube-tv.com/upload/videos/201611/18/prd_VpiG_15094cd.mp4?_upt=5ebab2601482316991\"" +
                                                                            "}," +
                                                                            "{" +
                                                                                "\"definition\": 20," +
                                                                                "\"desp\": \"标清480P\"," +
                                                                                "\"playurl\": \"http://upyun.aube-tv.com/upload/videos/201611/18/prd_VpiG_15094sd.mp4?_upt=054c93dc1482316991\"" +
                                                                            "}," +
                                                                            "{" +
                                                                                "\"definition\": 30," +
                                                                                "\"desp\": \"高清720P\"," +
                                                                                "\"playurl\": \"http://upyun.aube-tv.com/upload/videos/201611/18/prd_VpiG_15094hd.mp4?_upt=d6fa9f101482316991\"" +
                                                                            "}" +
                                                                        "]" +
                                                                    "}" +
                                                                "}" +
                                                            "}" +
                                                            "]" +
                                                "}}";

}
